<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>修改場地資料</title>
</head>
<body>
<% if(session.getAttribute("access") == "y" ){%>
<jsp:useBean id="mydb" scope="page" class="bean.ConDbBean"/> <%//連結資料庫的bean %>
<%
String id = new String(request.getParameter("pid").getBytes("iso-8859-1"),"utf-8"); //防止亂碼
String oldid = new String(request.getParameter("oldid").getBytes("iso-8859-1"),"utf-8");
String pclass=new String(request.getParameter("class").getBytes("iso-8859-1"),"utf-8");
String name = new String(request.getParameter("pname").getBytes("iso-8859-1"),"utf-8");
String state = new String(request.getParameter("pstate").getBytes("iso-8859-1"),"utf-8");
String ps = new String(request.getParameter("pps").getBytes("iso-8859-1"),"utf-8");
String person=new String(request.getParameter("person").getBytes("iso-8859-1"),"utf-8");

String pair =new String(request.getParameter("air").getBytes("iso-8859-1"),"utf-8");
String pdea=new String(request.getParameter("deafening").getBytes("iso-8859-1"),"utf-8");
String pacou=new String(request.getParameter("acoustics").getBytes("iso-8859-1"),"utf-8");
String mir=new String(request.getParameter("mir").getBytes("iso-8859-1"),"utf-8");
String scr=new String(request.getParameter("screen").getBytes("iso-8859-1"),"utf-8");
String pro=new String(request.getParameter("projector").getBytes("iso-8859-1"),"utf-8");
String light=new String(request.getParameter("light").getBytes("iso-8859-1"),"utf-8");
String wire=new String(request.getParameter("wireless").getBytes("iso-8859-1"),"utf-8");
String lcd=new String(request.getParameter("lcd").getBytes("iso-8859-1"),"utf-8");

String sql="UPDATE PLACE SET P_ID='"+id+"',P_NAME='"+name+"',P_STATE='"+state+"',PS='"+ps+"',P_CLASS='"+pclass+"',PERSON='"+person+"',AIR='"+pair+"',DEAFENING='"+pdea+"',ACOUSTICS='"+pacou+"',MIR='"+mir+"',SCREEN='"+scr+"',PROJECTOR='"+pro+"',LIGHT='"+light+"',WIRELESS='"+wire+"',LCD='"+lcd+"' WHERE P_ID='"+oldid+"'";
mydb.executeUpdate(sql);
response.sendRedirect("lookPlace.jsp"); //直接跳頁到lookPClass.jsp
%>
<%
  }
  else{
  	response.sendRedirect("../index.jsp"); //若沒有登入則回到index.jsp
  } 
  %>
</body>
</html>